<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>login</title>
</head>
<body>

  <div>
    <label for="user">用户名</label>
    <input type="text" id="user">
  </div>

  <div>
    <label for="password">密   码</label>
    <input type="password" id="password">
  </div>

  <div>
    <button id="login">登录</button>
    <button id="register">
        <a href="signUp.html">注册</a>
    </button>
  </div>

</body>
<script src="./js/jqurey.min.js"></script>
<script src="./js/main.js"></script>
<script>
  $(function () {
    $("#login").click(function () {
      if ($("#user").val().length == 0){
        return alert("请输入用户名!");
      }
      if ($("#password").val().length == 0){
        return alert("请输入密码!");
      }
 
      $.ajax({
        url:"http://localhost:3000/vue+nodejs/login/login.html",
        type:"POST",
        data:{
          username:$("#user").val(),
          password:$("#password").val()
        },
        success:function (res) {
          alert("登录成功!")
        },
        error:function (err) {
          console.log(err);
        }
      })
 
    })
  });
</script>
</html>